package com.Servlet;

import com.Service.Impl.Okayapi_goodsServiceImpl;
import com.Service.Okayapi_goodsService;
import com.entity.Okayapi_goods;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @Author: 冷俊杰
 * @Description: 管理员展示商品
 * @DateTime: 2022/6/20 10:30
 **/
@WebServlet(name = "/AdminGoodsServlet", value = "/AdminGoodsServlet")
public class AdminGoodsServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Okayapi_goodsService service = new Okayapi_goodsServiceImpl();
        List<Okayapi_goods> ogoods = service.GOODS_LIST();
        System.out.println(ogoods);
        request.setAttribute("ogoods", ogoods);
        request.getRequestDispatcher("./CommodityManage.jsp").forward(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
